#include "net_messages.h"
#include <arpa/inet.h>
#include <glib.h>

GHashTable *peerlist;
pthread_mutex_t peerlist_mtx;
#define lock_peerlist() 	pthread_mutex_lock(&peerlist_mtx)
#define unlock_peerlist() 	pthread_mutex_unlock(&peerlist_mtx)

void peerlist_add(pkt_pong *p);


void peerlist_init();
int peerlist_to_nodecache();

void printf_peer(gpointer, gpointer, gpointer);
#define printf_peerlist()	g_hash_table_foreach(peerlist,(GHFunc)printf_peer, NULL)
void peerlist_to_FILE(gpointer,gpointer,gpointer);
pkt_pong* peerlist_get(guint32);
void peerlist_add(pkt_pong *p);
int peerlist_to_nodecache();